<style lang="less">
  .ue-module-wrap {
    .el-table {
      flex: 1;
      .el-icon-check {
        display: none;
      }
      .current-row {
        .el-icon-check {
          display: inline-block;
        }
      }
    }
  }
  .ue-dialog-edit {
    .el-dialog__body{
      padding-top: 10px;
    }
    .top_row {
      font-size: 15px;
      padding-bottom: 8px;
    }
    .top_title {
      font-weight: 600;
    }
    .top_content {

    }
  }
  .table-font-color {
    color: red;
  }
</style>
<!--先行理赔申请管理-->
<template>
  <el-tabs active-name="first" class="ue-module-wrap" type="border-card">
    <el-tab-pane label="待审核" name="first">
      <!--工具条-->
      <search-bar style="height: 90px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="订单编号">
              <el-input  v-model="searchCondition.LIKE_orderNumber"
                         placeholder="请输入订单编号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="申请日期">
              <el-date-picker
                v-model="dateRangeApplyFor"
                type="daterange"
                align="right"
                placeholder="选择日期范围">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="下单日期">
              <el-date-picker
                v-model="dateRangeShipmentsDate"
                type="daterange"
                align="right"
                placeholder="选择日期范围">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="申请人">
              <el-input  v-model="searchCondition.LIKE_proposer"
                         placeholder="请输入申请人名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="发货人">
              <el-input  v-model="searchCondition.LIKE_shipmentsContactName"
                         placeholder="请输入发货人名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="货物名称">
              <el-input  v-model="searchCondition.LIKE_cargoInfo"
                         placeholder="请输入货物名称"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </search-bar>
      <!-- 操作 openDialog3-->
      <el-col :span="24" style="margin-bottom: 10px">
        <el-button type="primary" @click="dialogOpenAudit">审核确认</el-button>
        <el-button type="primary" @click="resetSearchCondition" style="float: right">重置</el-button>
        <el-button type="primary" @click="searchTableList" style="float: right">查询</el-button>
        <el-button type="primary" @click="exportExcellentRouteCompensationInstance" style="float: right" :disabled=true>导出</el-button>
      </el-col>
      <!-- 表格-->
      <el-table highlight-current-row border
                :data="tableData"
                v-loading="listLoading"
                @current-change="selsChange"
                style="width: 100%;height:100%">
        <el-table-column label="选中" width="50" align="center">
          <template slot-scope="scope">
            <i class="el-icon-check"></i>
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="申请日期" width="100" align="center">
          <template slot-scope="scope">
            <label v-if="scope.row.createDate">{{scope.row.createDate.substring(0, 10)}}</label>
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip fit prop="orderNumber" label="订单编号" width="150" align="center">
          <template slot-scope="scope">
            <a style="cursor: pointer;text-decoration:underline;color: #20a0ff"
               @click="orderSelectInfo(scope.row.orderId,scope.row.orderNumber)">{{ scope.row.orderNumber}}</a>
          </template>
        </el-table-column>
        <el-table-column prop="createOrderDate" label="下单日期" width="100" align="center">
          <template slot-scope="scope">
            <label v-if="scope.row.createOrderDate">{{scope.row.createOrderDate.substring(0, 10)}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="proposer" label="申请人" width="100">
        </el-table-column>
        <el-table-column prop="moneyApplyFor" label="申请补偿金" width="100">
          <template slot-scope="scope">
            <label class="table-font-color">{{scope.row.moneyApplyFor}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="shipmentsContactName" label="发货人" width="80">
        </el-table-column>
        <el-table-column prop="cargoInfo" label="货物信息" min-width="150">
        </el-table-column>
        <el-table-column prop="ageingScope" label="承诺时效" width="80">
        </el-table-column>
        <el-table-column prop="orderDepartDate" label="发车日期" width="150">
        </el-table-column>
        <el-table-column prop="orderArrivalDate" label="到达日期" width="150">
        </el-table-column>
        <el-table-column prop="actualScope" label="实际时效(小时)" width="120">
          <template slot-scope="scope">
            <label class="table-font-color">{{scope.row.actualScope}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="orderStatusName" label="订单状态" width="100">
        </el-table-column>
      </el-table>
      <el-col :span="24" class="toolbar">
        <el-pagination
          :current-page="currentPage"
          :page-size="pageSize"
          @size-change="handlePageSizeChange"
          @current-change="handleCurrentPageChange"
          layout="total,sizes,prev, pager, next, jumper"
          :total="total" style="float: right">
        </el-pagination>
      </el-col>
    </el-tab-pane>
    <el-tab-pane label="已审核" name="second">
      <!--工具条-->
      <search-bar style="height: 90px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="订单编号" label-width="100px">
              <el-input  v-model="searchConditionB.LIKE_orderNumber"
                         placeholder="请输入订单编号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="申请日期" label-width="100px">
              <el-date-picker
                v-model="dateRangeApplyForB"
                type="daterange"
                align="right"
                placeholder="选择日期范围">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="下单日期" label-width="100px">
              <el-date-picker
                v-model="dateRangeShipmentsDateB"
                type="daterange"
                align="right"
                placeholder="选择日期范围">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="审核状态" label-width="100px">
              <el-select  v-model="searchConditionB.EQ_auditStatus" placeholder="请选择审核状态">
                <el-option v-for="item in $store.getters.AUDIT_STATUS"
                           :key="item.dictVal"
                           :label="item.cnDictValname"
                           :value="item.dictVal"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="申请人" label-width="100px">
              <el-input  v-model="searchConditionB.LIKE_proposer"
                         placeholder="请输入申请人名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="发货人" label-width="100px">
              <el-input  v-model="searchConditionB.LIKE_shipmentsContactName"
                         placeholder="请输入发货人名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="货物名称" label-width="100px">
              <el-input  v-model="searchConditionB.LIKE_cargoInfo"
                         placeholder="请输入货物名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="划账状态" label-width="100px">
              <el-select  v-model="searchConditionB.EQ_remitAccountStatus" placeholder="请选择划账状态">
                <el-option v-for="item in $store.getters.INDICATOR"
                           :key="item.dictVal"
                           :label="item.cnDictValname == '是'? '已划账':'未划账'"
                           :value="item.dictVal"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </search-bar>
      <!-- 操作 -->
      <el-col :span="24" style="margin-bottom: 10px">
        <el-button type="primary" @click="dialogOpenRemitAccount" :disabled="isRemitted">划账确认</el-button>
        <el-button type="primary" @click="dialogOpenAuditView">审核详情</el-button>
        <el-button type="primary" @click="resetSearchConditionB" style="float: right">重置</el-button>
        <el-button type="primary" @click="searchTableListB" style="float: right">查询</el-button>
        <el-button type="primary" @click="exportExcellentRouteCompensationInstance" style="float: right" :disabled=true>导出</el-button>
      </el-col>
      <!-- 表格-->
      <el-table highlight-current-row border
                :data="tableDataB"
                v-loading="listLoadingB"
                @current-change="selsChangeB"
                style="width: 100%;height:100%">
        <el-table-column label="选中" width="50" align="center">
          <template slot-scope="scope">
            <i class="el-icon-check"></i>
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="申请日期" width="100" align="center">
          <template slot-scope="scope">
            <label v-if="scope.row.createDate">{{scope.row.createDate.substring(0, 10)}}</label>
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip fit prop="orderNumber" label="订单编号" width="150" align="center">
          <template slot-scope="scope">
            <a style="cursor: pointer;text-decoration:underline;color: #20a0ff"
               @click="orderSelectInfo(scope.row.orderId,scope.row.orderNumber)">{{ scope.row.orderNumber}}</a>
          </template>
        </el-table-column>
        <el-table-column prop="createOrderDate" label="下单日期" width="100" align="center">
          <template slot-scope="scope">
            <label v-if="scope.row.createOrderDate">{{scope.row.createOrderDate.substring(0, 10)}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="proposer" label="申请人" width="100">
        </el-table-column>
        <el-table-column prop="moneyApplyFor" label="申请补偿金" width="100">
          <template slot-scope="scope">
            <label class="table-font-color">{{scope.row.moneyApplyFor}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="auditStatusName" label="审核状态" width="100">
        </el-table-column>
        <el-table-column prop="moneyNegotiatory" label="确认补偿金" width="100">
          <template slot-scope="scope">
            <label class="table-font-color" v-if="scope.row.auditStatus === 109016003">-</label>
            <label class="table-font-color" v-else>{{scope.row.moneyNegotiatory}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="remitAccountTypeName" label="划账方式" width="100">
        </el-table-column>
        <el-table-column prop="remitAccountStatusName" label="划账状态" width="100" align="center">
          <template slot-scope="scope">
            <label v-if="scope.row.auditStatus === 109016003">-</label>
            <label v-else>{{scope.row.remitAccountStatusName}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="shipmentsContactName" label="发货人" width="80">
        </el-table-column>
        <el-table-column prop="cargoInfo" label="货物信息" min-width="150">
        </el-table-column>
        <el-table-column prop="ageingScope" label="承诺时效" width="80">
        </el-table-column>
        <el-table-column prop="orderDepartDate" label="发车日期" width="150">
        </el-table-column>
        <el-table-column prop="orderArrivalDate" label="到达日期" width="150">
        </el-table-column>
        <el-table-column prop="actualScope" label="实际时效(小时)" width="120">
          <template slot-scope="scope">
            <label class="table-font-color">{{scope.row.actualScope}}</label>
          </template>
        </el-table-column>
        <el-table-column prop="orderStatusName" label="订单状态" width="100">
        </el-table-column>
      </el-table>
      <el-col :span="24" class="toolbar">
        <el-pagination
          :current-page="currentPageB"
          :page-size="pageSizeB"
          @size-change="handlePageSizeChangeB"
          @current-change="handleCurrentPageChangeB"
          layout="total,sizes,prev, pager, next, jumper"
          :total="totalB" style="float: right">
        </el-pagination>
      </el-col>
    </el-tab-pane>
    <!--审核确认-->
    <el-dialog :title="dialogTitle" width="60%" :visible.sync="dialogVisible" :close-on-click-modal="false"  @close="resetInfoForm" class="ue-dialog-edit">
      <el-row class="top_row">
        <el-col :span="6">
          <label class="top_title">订单号：</label>
          <label class="top_content">{{objInfo.orderNumber}}</label>
        </el-col>
        <el-col :span="6">
          <label class="top_title">申请人：</label>
          <label>{{objInfo.proposer}}</label>
        </el-col>
        <el-col :span="6">
          <label class="top_title">发货人：</label>
          <label>{{objInfo.shipmentsContactName}}</label>
        </el-col>
      </el-row>
      <el-row class="top_row">
        <el-col :span="12">
          <label class="top_title">订单发车日期：</label>
          <label>{{objInfo.orderDepartDate}}</label>
        </el-col>
        <el-col :span="12">
          <label class="top_title">订单到达日期：</label>
          <label>{{objInfo.orderArrivalDate}}</label>
        </el-col>
      </el-row>
      <el-row class="top_row">
        <el-col :span="24">
          <label class="top_title">承诺时效：</label>
          <label>{{objInfo.ageingScope}} 小时</label>
        </el-col>
      </el-row>
      <el-row class="top_row">
        <el-col :span="24">
          <label class="top_title">实际时效：</label>
          <label>{{objInfo.actualScope}} 小时</label>
        </el-col>
      </el-row>
      <el-row class="top_row">
        <el-col :span="24">
          <label class="top_title">申请时效补偿金额：</label>
          <label style="color: red">{{objInfo.moneyApplyFor}} 元</label>
          <label v-if="objInfo.compensateWay">({{objInfo.compensateWay}})</label>
        </el-col>
      </el-row>
      <el-row class="top_row">
        <el-col :span="24">
          <label class="top_title">划账方式：</label>
          <label v-if="objInfo.remitAccountType === 109017001">转入账户余额</label>
          <label v-if="objInfo.remitAccountType === 109017002">转入银行卡</label>
        </el-col>
      </el-row>
      <el-row class="top_row" style="background-color: #F2F2F2;width: 70%" v-if="objInfo.remitAccountType === 109017002">
        <el-col :span="24">
          <label class="top_title">转账银行：</label>
          <label>{{objInfo.bankName}}</label>
        </el-col>
      </el-row>
      <el-row class="top_row" style="background-color: #F2F2F2;width: 70%" v-if="objInfo.remitAccountType === 109017002">
        <el-col :span="24">
          <label class="top_title">银行账号：</label>
          <label>{{objInfo.account}}</label>
        </el-col>
      </el-row>
      <el-row class="top_row" style="background-color: #F2F2F2;width: 70%" v-if="objInfo.remitAccountType === 109017002">
        <el-col :span="24">
          <label class="top_title">账户名称：</label>
          <label>{{objInfo.accountName}}</label>
        </el-col>
      </el-row>
      <el-row class="top_row" style="border-bottom: 1px solid lavender">
        <el-col :span="24">
          <label class="top_title">申请价格差异理由描述：</label>
          <label>{{objInfo.applyRemark}}</label>
        </el-col>
      </el-row>
      <el-form style="margin-top: 10px" :key="dialogKey" :model="objInfo" label-position="left" :rules="objInfoRules" label-width="120px" ref="objInfo" border>
        <el-row>
          <el-col :span="24">
            <el-form-item label="审核结果:" prop="auditStatus">
              <el-radio-group v-model="objInfo.auditStatus" :disabled="isView">
                <el-radio :label="109016003">审核不通过</el-radio>
                <el-radio :label="109016002">审核通过</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="16">
            <el-form-item label="协商补偿金额:" prop="moneyNegotiatory">
              <el-input type="number" v-model="objInfo.moneyNegotiatory" placeholder="请输入协商补偿金额" :disabled="isView"> <template slot="append">元</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="16">
            <el-form-item label="审核结果描述" prop="auditRemark">
              <el-input type="textarea" :rows="3" v-model="objInfo.auditRemark" placeholder="请输入审核结果描述" :disabled="isView"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="isView === false">
          <el-form-item>
            <el-button @click.native="resetInfoForm">关闭</el-button>
            <el-button type="primary" @click.native="handleSubmit" v-if="isView === false" :loading="submitLoading"  :disabled="isDisabled">保存</el-button>
          </el-form-item>
        </el-row>
      </el-form>
    </el-dialog>
    <!--划账确认-->
    <el-dialog :title="dialogTitle2" :visible.sync="dialogVisible2" :close-on-click-modal="false" class="ue-dialog-edit" @close="resetInfoFormRemitAccount">
      <el-form style="margin-top: 10px" :model="objInfoRemitAccount" label-position="left" label-width="120px" ref="objInfoRemitAccount" :rules="objInfoRules">
        <el-row>
          <label>订单号: {{objInfoRemitAccount.orderNumber}}</label>
        </el-row>
        <el-row>
          <label>确认是否已经将协商申请（{{objInfoRemitAccount.servicePromiseTypeName}}) 金额:<label style="color: red">¥ {{objInfoRemitAccount.moneyNegotiatory}}</label></label><br/>
          <label>转入申请人的{{objInfoRemitAccount.remitAccountTypeName}}吗？</label>
        </el-row>
        <el-row class="top_row" style="background-color: #F2F2F2;width: 70%" v-if="objInfoRemitAccount.remitAccountType === 109017002">
          <el-col :span="24">
            <label class="top_title">转账银行：</label>
            <label>{{objInfoRemitAccount.bankName}}</label>
          </el-col>
        </el-row>
        <el-row class="top_row" style="background-color: #F2F2F2;width: 70%" v-if="objInfoRemitAccount.remitAccountType === 109017002">
          <el-col :span="24">
            <label class="top_title">银行账号：</label>
            <label>{{objInfoRemitAccount.account}}</label>
          </el-col>
        </el-row>
        <el-row class="top_row" style="background-color: #F2F2F2;width: 70%" v-if="objInfoRemitAccount.remitAccountType === 109017002">
          <el-col :span="24">
            <label class="top_title">账户名称：</label>
            <label>{{objInfoRemitAccount.accountName}}</label>
          </el-col>
        </el-row>
        <div v-if="objInfoRemitAccount.remitAccountType === 109017002">
          <el-row style="margin-top: 10px" >
            <el-col :span="16">
              <el-form-item label="划账日期:" prop="remitAccountDate">
                <el-date-picker v-model="objInfoRemitAccount.remitAccountDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="16">
              <el-form-item label="划账处理人:" prop="remitAccountUserName">
                <el-input v-model="objInfoRemitAccount.remitAccountUserName" placeholder="请输入划账处理人"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="16">
              <el-form-item label="划账流水号:" prop="remitAccountSerialNo">
                <el-input v-model="objInfoRemitAccount.remitAccountSerialNo" placeholder="请输入划账流水号"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="16">
              <el-form-item label="备注" prop="remitAccountRemark">
                <el-input type="textarea" :rows="3" v-model="objInfoRemitAccount.remitAccountRemark" placeholder="请输入备注"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <el-row style="margin-top: 10px">
          <el-form-item>
            <el-button @click.native="resetInfoFormRemitAccount">关闭</el-button>
            <el-button type="primary" @click.native="handleSubmitRemitAccount" :loading="submitLoading">保存</el-button>
          </el-form-item>
        </el-row>
      </el-form>
    </el-dialog>
    <!--订单详情-->
    <order-track-detail ref="orderTrackDetail"></order-track-detail>
  </el-tabs>
</template>

<script>
import { searchInfoList, getInfoByIdApi, noticeOfClaimAudit, noticeOfClaimRemitAccount } from '../../../api/stowage/ExcellentRouteCompensation';
import { objToFilter, resetObjNull, isEmpty, getSelectObect } from '../../../lib/util';
import OrderTrackDetail from '../../order/OrderTrackDetail.vue';
export default {
  components: {
    OrderTrackDetail
  },
  data () {
    return {
      isView: false,
      // --------待审核----
      searchCondition: {
        'LIKE_orderNumber': null,
        'LIKE_proposer': null,
        'LIKE_shipmentsContactName': null,
        'LIKE_cargoInfo': null
      },
      dateRangeApplyFor: [],
      dateRangeShipmentsDate: [],
      sels: [],
      total: 0,
      currentPage: 1,
      pageSize: 10,
      sortProp: null,
      sortOrder: 'ascending',
      listLoading: false,
      tableData: [],
      // --------已审核----
      isFirstChangeTabPane: true,
      searchConditionB: {
        'LIKE_orderNumber': null,
        'LIKE_proposer': null,
        'LIKE_shipmentsContactName': null,
        'EQ_remitAccountStatus': null,
        'LIKE_cargoInfo': null,
        'EQ_auditStatus': null
      },
      dateRangeApplyForB: [],
      dateRangeShipmentsDateB: [],
      selsB: [],
      totalB: 0,
      currentPageB: 1,
      pageSizeB: 10,
      sortPropB: 'createDate',
      sortOrderB: 'descending',
      listLoadingB: false,
      tableDataB: [],
      // 弹窗1-审核确认
      isDisabled: false,
      dialogVisible: false,
      submitLoading: false,
      dialogTitle: '时效补偿申请审核',
      dialogKey: 0,
      objInfo: {
        'auditStatus': 109016002
      },
      objInfoRules: {
        routeName: [
          {required: true, message: '请输入精品线路名称', trigger: 'blur'}
        ],
        auditStatus: [
          {required: true, message: '请选择审核结果'}
        ],
        moneyNegotiatory: [
          {required: true, message: '请输入协商补偿金额'}
        ],
        auditRemark: [
          {required: true, message: '请输入审核结果描述'}
        ],
        remitAccountDate: [
          {required: true, message: '请选择划账日期'}
        ],
        remitAccountUserName: [
          {required: true, message: '请输入划账处理人'}
        ],
        remitAccountSerialNo: [
          {required: true, message: '请输入划账流水号'}
        ]
      },
      // 弹窗2-划账确认
      isRemitted: true, // 是否已划账
      dialogVisible2: false,
      dialogTitle2: '划账确认',
      objInfoRemitAccount: {
        'id': null,
        'servicePromiseType': null,
        'servicePromiseTypeName': null,
        'remitAccountType': null,
        'moneyNegotiatory': null,
        'remitAccountDate': null,
        'remitAccountUserId': null,
        'remitAccountUserName': null,
        'remitAccountSerialNo': null,
        'remitAccountRemark': null,
        'bankName': null,
        'accountName': null,
        'account': null
      },
      fs: ''
    };
  },
  methods: {
    exportExcellentRouteCompensationInstance () {
      let filters = this.fs + ';EQ_servicePromiseType=109014002';
      location.href = '/api/v2.0/admin/excellent_route_notice_of_claim/export?filters=' + filters;
    },
    // 打开审核确认弹窗
    dialogOpenAudit () {
      if (isEmpty(this.sels)) {
        return this.$message.error('请选择数据！');
      };
      this.getInfoById(this.sels.id, false);
    },
    // 打开划账确认弹窗
    dialogOpenRemitAccount () {
      if (isEmpty(this.selsB)) {
        return this.$message.error('请选择数据！');
      };
      this.getInfoByIdForRemitAccount(this.selsB.id);
    },
    // 打开审核详情
    dialogOpenAuditView () {
      if (isEmpty(this.selsB)) {
        return this.$message.error('请选择数据！');
      };
      this.getInfoById(this.selsB.id, true);
    },
    // ------待审核---------
    // 多选操作
    selsChange (sels) {
      this.sels = sels;
    },
    // 排序操作
    sortChange (o) {
      this.sortProp = o.prop;
      this.sortOrder = o.order;
      this.searchTableList();
    },
    // 每页几条操作
    handlePageSizeChange (val) {
      this.pageSize = val;
      this.searchTableList();
    },
    // 第几页操作
    handleCurrentPageChange (val) {
      this.currentPage = val;
      this.searchTableList();
    },
    // 重置查询条件
    resetSearchCondition () {
      resetObjNull(this.searchCondition);
      this.dateRangeApplyFor = [];
      this.dateRangeShipmentsDate = [];
    },
    // 查询列表执行
    loadingLists (filter = '') {
      // 时效补偿申请--待审核过滤+补偿类型过滤
      filter += ';EQ_servicePromiseType=109014002;EQ_auditStatus=109016001';
      this.fs = filter;
      this.listLoading = true;
      searchInfoList({
        filters: filter,
        size: this.pageSize,
        page: this.currentPage,
        sorts: (this.sortProp === null ? '' : (this.sortOrder === 'ascending' ? '+' : '-') + this.sortProp)
      }).then(res => {
        if (res.data.successFlg) {
          this.tableData = res.data.detailModelList;
          this.currentPage = res.data.currPage;
          this.total = res.data.totalCount;
          this.pageSize = res.data.pageSize;
        };
        this.listLoading = false;
      });
    },
    // 查询调用
    searchTableList () {
      let filters = objToFilter(this.searchCondition);
      if (this.dateRangeApplyFor[0]) {
        filters += ';GT_createDate=' + this.dateRangeApplyFor[0].toJSON();
        filters += ';LT_createDate=' + this.$ue.addDays(this.dateRangeApplyFor[1], 1).toJSON();
      };
      if (this.dateRangeShipmentsDate[0]) {
        filters += ';GT_createOrderDate=' + this.dateRangeShipmentsDate[0].toJSON();
        filters += ';LT_createOrderDate=' + this.$ue.addDays(this.dateRangeShipmentsDate[1], 1).toJSON();
      }
      this.loadingLists(filters);
    },
    // 根据ID获取获取审核信息失败
    getInfoById (id, isView) {
      getInfoByIdApi(id).then(res => {
        this.isView = isView;
        this.dialogVisible = true;
        if (res.data.successFlg) {
          let info = res.data.obj;
          this.objInfo = info;
          if (this.objInfo.moneyNegotiatory <= 0) {
            this.objInfo.moneyNegotiatory = this.objInfo.moneyApplyFor;
          }
        } else {
          this.$message.error('获取审核信息失败!');
        }
      });
    },
    // ------已审核---------
    // 多选操作
    selsChangeB (sels) {
      this.selsB = sels;
      if (this.selsB.remitAccountStatus === 111002001 || this.selsB.auditStatus === 109016003) {
        this.isRemitted = true;
      } else {
        this.isRemitted = false;
      }
    },
    // 排序操作
    sortChangeB (o) {
      this.sortPropB = o.prop;
      this.sortOrderB = o.order;
      this.searchTableListB();
    },
    // 每页几条操作
    handlePageSizeChangeB (val) {
      this.pageSizeB = val;
      this.searchTableListB();
    },
    // 第几页操作
    handleCurrentPageChangeB (val) {
      this.currentPageB = val;
      this.searchTableListB();
    },
    // 重置查询条件
    resetSearchConditionB () {
      resetObjNull(this.searchConditionB);
      this.dateRangeApplyForB = [];
      this.dateRangeShipmentsDateB = [];
    },
    // 查询列表执行
    loadingListsB (filter = '') {
      // 时效补偿申请--待审核过滤+补偿类型过滤
      filter += ';EQ_servicePromiseType=109014002;IN_auditStatus=109016002,109016003';
      this.fs = filter;
      this.listLoadingB = true;
      searchInfoList({
        filters: filter,
        size: this.pageSizeB,
        page: this.currentPageB,
        sorts: (this.sortPropB === null ? '' : (this.sortOrderB === 'ascending' ? '+' : '-') + this.sortPropB)
      }).then(res => {
        if (res.data.successFlg) {
          this.tableDataB = res.data.detailModelList;
          this.currentPageB = res.data.currPage;
          this.totalB = res.data.totalCount;
          this.pageSizeB = res.data.pageSize;
        };
        this.listLoadingB = false;
      });
    },
    // 查询调用
    searchTableListB () {
      let filters = objToFilter(this.searchConditionB);
      if (this.dateRangeApplyForB[0]) {
        filters += ';GT_createDate=' + this.dateRangeApplyForB[0].toJSON();
        filters += ';LT_createDate=' + this.$ue.addDays(this.dateRangeApplyForB[1], 1).toJSON();
      };
      if (this.dateRangeShipmentsDateB[0]) {
        filters += ';GT_createOrderDate=' + this.dateRangeShipmentsDateB[0].toJSON();
        filters += ';LT_createOrderDate=' + this.$ue.addDays(this.dateRangeShipmentsDateB[1], 1).toJSON();
      }
      this.loadingListsB(filters);
    },
    // 根据ID获取申请补偿--用于划账确认
    getInfoByIdForRemitAccount (id) {
      getInfoByIdApi(id).then(res => {
        this.dialogVisible2 = true;
        if (res.data.successFlg) {
          let info = res.data.obj;
          this.objInfoRemitAccount = info;

          // 默认信息（划账日期、划账处理人，备注）
          this.objInfoRemitAccount.remitAccountDate = new Date();
          this.objInfoRemitAccount.remitAccountUserId = this.$store.state.userId;
          this.objInfoRemitAccount.remitAccountUserName = this.$store.state.username;
          // 划账方式名
          if (this.objInfoRemitAccount.remitAccountType === 109017002) {
            this.objInfoRemitAccount.remitAccountTypeName = '银行卡';
          }
          if (this.objInfoRemitAccount.remitAccountType === 109017001) {
            this.objInfoRemitAccount.remitAccountTypeName = '账户余额';
          }
        } else {
          this.$message.error('获取审核信息失败!');
        }
      });
    },
    // 重置审核确认弹窗
    resetInfoFormRemitAccount () {
      this.dialogVisible2 = false;
      resetObjNull(this.objInfoRemitAccount);
    },
    // 划账确认
    handleSubmitRemitAccount () {
      //  表单验证
      this.$refs['objInfoRemitAccount'].validate((valid) => {
        if (valid) {
          this.isView = true;
          this.objInfoRemitAccount.remitAccountStatus = 111002001;
          this.objInfoRemitAccount.remitAccountStatusName = '已划账';
          noticeOfClaimRemitAccount(this.objInfoRemitAccount.id, this.objInfoRemitAccount).then((res) => {
            if (res.data.successFlg === true) {
              this.dialogVisible2 = false;
              this.$message.success('划账确认成功！');
              this.searchTableListB();
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
      this.isView = false;
    },
    // ------------审核确认弹窗------------
    // 重置审核确认弹窗
    resetInfoForm () {
      this.dialogVisible = false;
      this.dialogKey = Math.random() - 0.5;
      this.objInfo = {};
    },
    // 提交审核确认
    handleSubmit () {
      //  表单验证
      this.$refs['objInfo'].validate((valid) => {
        if (valid) {
          this.isView = true;
          this.objInfo.auditStatusName = getSelectObect(this.objInfo.auditStatus, 'dictVal', this.$store.getters.AUDIT_STATUS).cnDictValname;
          if (!(this.objInfo.auditStatus) || this.objInfo.auditStatus === 109016001) {
            this.$message.error('请选择审核结果');
            return;
          }
          if (this.objInfo.auditStatus === 109016003) {
            this.objInfo.moneyNegotiatory = 0;
          }
          noticeOfClaimAudit(this.objInfo.id, this.objInfo).then((res) => {
            if (res.data.successFlg === true) {
              this.dialogVisible = false;
              this.$message.success('保存/修改成功！');
              this.searchTableList();
              this.searchTableListB();
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
      this.isView = false;
    },
    // 订单信息页面
    orderSelectInfo (orderId, orderNumber) {
      this.$refs.orderTrackDetail.show(orderId, orderNumber);
    }
  },
  computed: {
    editor () {
      return this.$refs.myQuillEditor.quill;
    }
  },
  mounted () {
    this.$store.commit('initDict');
    this.loadingLists();
    this.loadingListsB();
  }
};
</script>
